#!/bin/sh

SPEAKER="alsa_output.pci-0000_00_1f.3.analog-stereo"
HEADPHONES="alsa_output.usb-Logitech_G733_Gaming_Headset-00.analog-stereo"

switch_audio_device() {
    local DEVICE=$1
    pactl set-default-sink "$DEVICE"
    pactl set-sink-mute "$DEVICE" 1
    pactl set-sink-mute "$DEVICE" 0
}

if pactl list short sinks | grep -q "$HEADPHONES"; then
    switch_audio_device "$HEADPHONES"
else
    switch_audio_device "$SPEAKER"
fi

